package kgc.crm.controller;

import kgc.crm.annotation.UserPower;
import kgc.crm.annotation.VerificationToken;
import kgc.crm.enums.PowerEnum;
import kgc.crm.model.Area;
import kgc.crm.service.IAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("area")
@CrossOrigin
public class AreaController {
    @Autowired
    private IAreaService areaService;
    //根据传递的父类id来查询
    @UserPower(power = PowerEnum.INDEX)
    @VerificationToken
    @PostMapping("list")
    public ResponseEntity  searchByParentId(@RequestBody Area area){
        return areaService.searchByParentId(area);
    }
}
